<?php
class MaestrosController extends AppController {

	var $name = 'Maestros';
	var $scaffold;

	function beforeFilter() {
		parent::beforeFilter();
		$this->Auth->allowedActions = array('install');
	}

	function login() {
	    //Auth Magic
	}
	 
	function logout() {
	    //Leave empty for now.
	    $this->redirect($this->Auth->logout());
	}

	function install() {
		if($this->Maestro->find('count') == 0) {
			if (!empty($this->data)) {
				$this->Maestro->create();
				if ($this->Maestro->save($this->data)) {
					$this->Session->setFlash(__('The Maestro has been saved', true));
				} else {
					$this->Session->setFlash(__('The Maestro could not be saved. Please, try again.', true));
				}
			}
			$maestroGroups = $this->Maestro->MaestroGroup->find('list');
			$this->set(compact('maestroGroups'));
		} else {
			$this->redirect($this->Auth->loginAction);
		}
	}
}
?>